Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming
Accessing class data members
You can directly access data members from within the class where they are defined by using the data member name anywhere you can use a variable. This includes all data members defined directly within the class definition and all
PUBLICandPROTECTEDdata members defined in any super class of the class hierarchy.You can access
PUBLICdata members from outside the class hierarchy of a given object where they are defined by using an object reference to qualify the data member name. There is no direct access toPRIVATEorPROTECTEDdata members from outside the class hierarchy. Also, note that only variables can bePUBLIC. Therefore, if you want to expose a non-variable (such as a buffer, temp-table, query, or ProDataSet) to other classes, you must do so using one of these mechanisms:Thus, non-public data members support the object-oriented design paradigm of encapsulating data with the object interface and not exposing it to external agents directly.
This is the syntax for referencing a
PUBLICdata member from outside the object where it is defined:
Element descriptions for this syntax diagram follow:
object-referenceAn object reference to a class or super class where the
PUBLICdata member is defined.data-member-nameThe name of a
PUBLICdata member defined somewhere in the class hierarchy ofobject-reference.The following code from the
Mainsample class shows how you can access aPUBLICdata member from outside the class instance (acme.myObjs.CustObj) where it is defined:
In the previous example,
timestampis aPUBLICdata member defined in a super class (acme.myObjs.Common.CommonObj) of the object referenced byrCustObj.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |